"""manabe URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import logout_then_login
from django.urls import path, include

from manabe.password_view import change_email, change_password
from manabe.views import user_register, user_login, IndexView
from public.verifycode import verify_code

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    path('account/register/', user_register, name='register'),
    path('account/login/', user_login, name='login'),
    # django 默认实现
    path('logout/', logout_then_login, name='logout'),
    # path(r'^account/login/$', 'django.contrib.auth.views.login'),
]

urlpatterns += [
    # login_required 表示此视图必须在用户登录之后才可以访问

    path('', login_required(IndexView.as_view()), name='index'),
]

urlpatterns += [
    # login_required 表示此视图必须在用户登录之后才可以访问

    path('verify_code/', verify_code, name='verify_code'),
]

urlpatterns += [
    # login_required 表示此视图必须在用户登录之后才可以访问

    path('account/change_email/', login_required(change_email), name='change_email'),
]

urlpatterns += [
    # login_required 表示此视图必须在用户登录之后才可以访问

    path('account/change_password/', login_required(change_password), name='change_password'),
]

urlpatterns += [
    path('public/', include('public.urls')),
]

urlpatterns +=[
    path('envx/', include('envx.urls')),
]

urlpatterns +=[
    path('rightadmin/', include('rightadmin.urls')),
]

urlpatterns +=[
    path('serverinput/', include('serverinput.urls')),
]

urlpatterns += [
    path('api/', include('api.urls')),
]

urlpatterns += [
    path('app/', include('appinput.urls'))
]

urlpatterns += [
    path('deploy/', include('deploy.urls'))
]